/**
 * 用于显示消息弹框
 */

let defaultDuration = 2000

uni.$showSuccess = function(msg = '', duration) {
  uni.showToast({
    title: msg,
    icon: 'success',
    duration: duration || defaultDuration
  })
}

uni.$showError = function(msg = '数据请求失败', duration) {
  uni.showToast({
    title: msg,
    icon: 'error',
    duration: duration || defaultDuration
  })
}

uni.$showInfo = function(msg = '', duration) {
  uni.showToast({
    title: msg,
    icon: 'none',
    duration: duration || defaultDuration
  })
}